[Unit]
Description=Kong server
After=postgrest.service gotrue.service adminapi.service
Wants=postgrest.service gotrue.service adminapi.service

[Service]
Type=forking
ExecStart=/usr/local/bin/kong start -c /etc/kong/kong.conf
ExecReload=/usr/local/bin/kong reload -c /etc/kong/kong.conf
ExecStop=/usr/local/bin/kong stop
User=kong
EnvironmentFile=/etc/kong/kong.env
Slice=services.slice
Restart=always
RestartSec=3
LimitNOFILE=100000

# The kong user is unpriviledged and thus not permited to bind on ports < 1024
# Via systemd we grant the process a set of priviledges to bind to 80/443
# See http://archive.vn/36zJU
AmbientCapabilities=CAP_NET_BIND_SERVICE

[Install]
WantedBy=multi-user.target
